package cart.api.vo;

import cart.model.cart.CartItemGift;
import goods.model.Goods;
import goods.model.Product;
import goods.model.ProductFashion;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by Liang Wenxu on 2016/10/28.
 */
public class CartItemVo implements Serializable {
    public static Map<String, String> statusMap = new HashMap<>();

    static {
        statusMap.put("NORMAL", "0"); // 正常
        statusMap.put("LACK", "1"); // 缺货
        statusMap.put("NOT_ON_SALE", "2"); // 下架
    }

    protected String id;

    private String storeId;

    private String productId;

    private Product product;

    private String productFashId;

//    private GoodsFashion productFashion;

    private ProductFashion productFashion;

    private String goodsId;

    private Goods goods;

    private Integer count;

    private Integer score;

    private List<CartItemGift> giftList;

    private Date dateCreated;

    private Date lastUpdated;

    private Boolean isDelete = false; // 删除标志

    private Date deleteDate; // 删除时间

    private String status; // 商品状态，便于前台展示判断

    private BigDecimal sumSalePrice; // 销售价格小计

    private BigDecimal sumMarketPrice; // 市场价小计

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        CartItemVo cartItem = (CartItemVo) o;

        return !(id != null ? !id.equals(cartItem.id) : cartItem.id != null);

    }

    @Override
    public int hashCode() {
        return id != null ? id.hashCode() : 0;
    }

    @Override
    public String toString() {
        return "CartItem{" +
                "id='" + id + '\'' +
                ", storeId='" + storeId + '\'' +
                ", productId='" + productId + '\'' +
                ", productFashId='" + productFashId + '\'' +
                ", goodsId='" + goodsId + '\'' +
                ", count=" + count +
                ", score=" + score +
//                ", cart=" + cart +
                '}';
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public List<CartItemGift> getGiftList() {
        return giftList;
    }

    public void setGiftList(List<CartItemGift> giftList) {
        this.giftList = giftList;
    }

    public String getStoreId() {
        return storeId;
    }

    public void setStoreId(String storeId) {
        this.storeId = storeId;
    }

    public String getProductId() {
        return productId;
    }

    public void setProductId(String productId) {
        this.productId = productId;
    }

    public String getProductFashId() {
        return productFashId;
    }

    public void setProductFashId(String productFashId) {
        this.productFashId = productFashId;
    }

    public String getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(String goodsId) {
        this.goodsId = goodsId;
    }

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    public Integer getScore() {
        return score;
    }

    public void setScore(Integer score) {
        this.score = score;
    }

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

//    public GoodsFashion getProductFashion() {
//        return productFashion;
//    }

//    public void setProductFashion(GoodsFashion productFashion) {
//        this.productFashion = productFashion;
//    }

    public Goods getGoods() {
        return goods;
    }

    public void setGoods(Goods goods) {
        this.goods = goods;
    }

//    public void setProductFashion(GoodsFashion productFashion) {
//        this.productFashion = productFashion;
//    }

    public Date getDateCreated() {
        return dateCreated;
    }

    public void setDateCreated(Date dateCreated) {
        this.dateCreated = dateCreated;
    }

    public Date getLastUpdated() {
        return lastUpdated;
    }

    public void setLastUpdated(Date lastUpdated) {
        this.lastUpdated = lastUpdated;
    }

    public Boolean getIsDelete() {
        return isDelete;
    }

    public void setIsDelete(Boolean isDelete) {
        if(isDelete)
            this.deleteDate = new Date();
        this.isDelete = isDelete;
    }

    public Date getDeleteDate() {
        return deleteDate;
    }

    public void setDeleteDate(Date deleteDate) {
        this.deleteDate = deleteDate;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public ProductFashion getProductFashion() {
        return productFashion;
    }

    public void setProductFashion(ProductFashion productFashion) {
        this.productFashion = productFashion;
    }

    public BigDecimal getSumMarketPrice() {
        return sumMarketPrice;
    }

    public void setSumMarketPrice(BigDecimal sumMarketPrice) {
        this.sumMarketPrice = sumMarketPrice;
    }

    public BigDecimal getSumSalePrice() {
        return sumSalePrice;
    }

    public void setSumSalePrice(BigDecimal sumSalePrice) {
        this.sumSalePrice = sumSalePrice;
    }
}
